package main

import "fmt"

/**
方法继承和重写
*/

type People struct {
	id   int
	name string
	age  int
}

type Teacher struct {
	People
	school string
	salary int
}

func (p People) sayHello() {
	fmt.Println("Hello，" + p.name)
}



func main() {
	p := People{
		2,
		"秦始皇",
		12,
	}
	t := Teacher{
		People{
			id:   1,
			name: "王老师",
			age:  122,
		},
		"北京大学",
		10000,
	}
	t.sayHello()
	p.sayHello()
}
